﻿<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title><%:SiteResource.Title() %></title>
    <%="<meta name=\"Keywords\" content=\"" + SiteResource.KeyWord() + "\" />\r\n"%>
    <%="<meta name=\"Description\" content=\"" + SiteResource.Description() + "\" />\r\n"%>
    <script type="text/javascript" src="/Scripts/jquery-1.4.1.min.js"></script>
    <script type="text/javascript" src="/Scripts/library.js" charset="GB2312"></script>
    <script type="text/javascript" src="/Scripts/plug.js" charset="GB2312"></script>
    <style type="text/css">
    .noselected{ background-color:#ccc; height:30px;}
    .onselected{ background-color:#99f;height:30px;}
    </style>
</head>
<body>
    <div>
    <%var resumes = ViewData["resumes"] as ItemListBox<ResumeSheetModel>;
      var position = ViewData["position"] as PositionModel;%>
    <div>选择简历：</div>
    <%if (resumes != null)
      {%> 
      <form action="/home/requestjob" method="post">
      <input type="hidden" name="p" value="<%:Request.QueryString["p"] %>" />
      <input type="hidden" name="r" value="<%:position.RecruitId %>" />
      <div>
          <ul>
            <%int idx = 0;
              foreach (var item in resumes.Data)
              { %>
            <li <%if(idx == 0){ %>class="onselected"<%}else{ %>class="noselected"<%} %>>
            <input type="radio" id="rad<%:idx %>" name="resume" value="<%:item.Id %>" <%if(idx == 0){ %> checked="checked"<%} %> onclick="selectaction(this,'li')"/> 
            <label for="rad<%:idx %>"><a href="javascript:;"><%:item.Title %></a></label>
            <label for="rad<%:idx %>"><a href="javascript:;">选择</a></label>
            <a target="_blank" href="/home/resume_<%:item.Id %>">查看</a></li>
            <%idx++;
                } %>
          </ul>
      </div>
      <div>
        您选择了职位：<br />
        <%:position.RecruitSheet.Caption + " - " + position.PositionName%>
        薪酬为： <%if (position.MinSalary <= 0 && (position.MaxSalary <= 0 || position.MaxSalary <= position.MinSalary))
                {%>
                面议
            <%}
                else
                {
                    if (position.MinSalary > 0)
                    { %><%:position.MinSalary%>
            <%    }%>
            <%    if (position.MaxSalary > 0 && position.MaxSalary > position.MinSalary)
                    {%>
                    - <%:position.MaxSalary%>元
            <%    }%>
                    /<%:position.Period.Mapping()%>
            <%}%><br />
        您期望得到的薪酬为：
        <div>
            <div class="onselected">
                <input id="radb" type="radio" value="1" name="salarytype" checked="checked" onclick="selectaction(this,'div')"/>
                面议
                <label for="radb"><a href="javascript:;">选择这种</a></label>
            </div>
            <div class="noselected">
                <input id="rada" type="radio" value="2" name="salarytype"  onclick="selectaction(this,'div')"/>
                <input type="text" name="salary" value="<%:(int)position.MinSalary %>"/>
                <select id="sltPeriod" name="period"></select>
                <label for="rada"><a href="javascript:;">选择这种</a></label>
            </div>
            
        </div>
      </div>
      <div>
        求职标题：<input type="text" name="Title" value="" />
      </div>
      <div>
        附加信息：<textarea name="message" style="height:150px;width:450px"></textarea>
      </div>
      <div style="text-align:center; margin-top:30px;" id="submitbox">
      <input type="submit" value="投递简历" />
      </div>
      </form>
    <%}
      else
      { %>
      您还没有维护简历。<a href="/usercenter/newresume">添加简历</a>
    <%} %>
    </div>
    <script type="text/javascript">
        var control = new plug.Control();
        $(function () {
            control.BuildSelect({ element: 'sltPeriod', defaultvalue: '<%:(int)position.Period %>' }, 'Period');
        });
        function selectaction(sender,parele) {
            var classname = $(sender).parent().attr('class');
            if (classname != 'onselected') {
                $(sender).parent().siblings(parele).each(function () {
                    $(this).attr('class', 'noselected');
                });
                $(sender).parent().attr('class', 'onselected');
            }
        }
        $('form').submit(function () {
            var salarytype = $('input:radio[name="salarytype"]:checked').val();
            if (salarytype == '2') {
                if (!/^\d+$/.test($('input[name="salary"]').val())) {
                    $('#submitbox').append($('<span style="color:red;">期望薪资输入有误，必须为数字</span>'));
                    return false;
                }
            }
            if ($('input[name="Title"]').val() == '') {
                $('#submitbox').append($('<span style="color:red;">请输入求职标题</span>'));
                return false;
            }
        });
    </script>
</body>
</html>
